package com.java.asviteslkyy.flashlight;

interface iFace {
    double takeEnergy();
}

public class Battery implements iFace {
    String name;
    double voltage;
    double maxAmperage;
    int timeInUse;
    int id;

    public Battery(boolean alkaline) {
        if (alkaline) {
            this.name = "Alkaline";
            this.voltage = 1.5;
            this.maxAmperage = 2.2;
            this.timeInUse = 0;
        } else {
            this.name = "Standart";
            this.voltage = 1.5;
            this.maxAmperage = 1.7;
            this.timeInUse = 0;
        }
    }

    public double takeEnergy() {
        this.voltage -= voltage * Math.sqrt(timeInUse) / 60;
        return voltage * maxAmperage;
    }
}
